using System;
using Framework.Common.AOP.Cache;
using System.Threading;

namespace Framework.Sample
{
    public class TestAopCache : ITest
    {
        public void Test()
        {
            Framework.Common.PerformanceHelper.OutputAction = Console.Write;
            Console.WriteLine(Test1(1));
            Console.WriteLine(Test1(1));
            Console.WriteLine(Test1(1));
            Thread.Sleep(2000);
            Test2(1);
            Console.WriteLine(Test1(1));

            Console.Read();
        }

        [Cache]
        public DateTime Test1(int id)
        {
            return DateTime.Now;
        }

        [CacheTrigger(typeof(TestAopCache), "Test1")]
        public DateTime Test2(int id)
        {
            return DateTime.Now;
        }
    }
}